using System;
using System.Collections.Generic;
using System.Text;
using MacomberMap.Common.Components;

namespace MacomberMap.Common.Events
{
    /// <summary>
    /// This class holds information on a contingency violation
    /// </summary>
    public class MM_Event_ContingencyViolation: MM_Event
    {
        #region Variable declatarions
        /// <summary>The contingency definition (if any) associated with the alarm/Event/event</summary>        
        public MM_Contingency Contingency;
        
        /// <summary>The element that is contingency violated</summary>
        public MM_Element Element;

        /// <summary>
        /// The type of contingency violation
        /// </summary>
        public enum enumContinengencyType
        {
            ///<summary>Branch</summary>
            Branch=0,
            ///<summary>High Voltage</summary>
            HighVoltage=1,
            ///<summary>Branch</summary>
            LowVoltage=2      
        }

        /// <summary>
        /// The type of contingency violation
        /// </summary>
        public enumContinengencyType ContingencyType;
        #endregion

        /// <summary>
        /// 
        /// </summary>
        /// <param name="OutMenu"></param>
        public override void AddMenuItems(System.Windows.Forms.ContextMenuStrip OutMenu)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override System.Windows.Forms.ListViewItem BuildListViewItem()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="OutParent"></param>
        public override void DisplayDetails(System.Windows.Forms.Control OutParent)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="lvItem"></param>
        public override void UpdateListViewItem(System.Windows.Forms.ListViewItem lvItem)
        {
            throw new Exception("The method or operation is not implemented.");
        }

        /// <summary>
        /// Sort the contingency violations
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override int CompareTo(object obj)
        {
            int CompareResults = Contingency.CompareTo((obj as MM_Event_ContingencyViolation).Contingency);
            int ContType = ContingencyType.CompareTo((obj as MM_Event_ContingencyViolation).ContingencyType);
            if (CompareResults == 0 && ContType == 0)
                return Element.CompareTo((obj as MM_Event_ContingencyViolation).Element);
            else if (CompareResults == 0)
                return ContType;
            else
                return CompareResults;
                
        }
    }
}
